package homework.ch11_13.p3;

import java.util.Objects;

public class Faculty extends Person implements Cloneable{
    private String email;
    private String facultyId;
    private String tital;

    public Faculty() {

    }

    public Faculty(int age, String name, String email, String facultyId, String tital) {
        super(age, name);
        this.email = email;
        this.facultyId = facultyId;
        this.tital = tital;
    }

    @Override
    public Object clone() throws CloneNotSupportedException {
        Faculty faculty=(Faculty)super.clone();
        faculty.email=this.email;
        faculty.facultyId=this.facultyId;
        faculty.tital=this.tital;
        return faculty;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Faculty)) return false;
        if (!super.equals(o)) return false;
        Faculty faculty = (Faculty) o;
        return email.equals(faculty.email) && facultyId.equals(faculty.facultyId) && tital.equals(faculty.tital);
    }

    @Override
    public int hashCode() {
        return Objects.hash(email, facultyId, tital);
    }

    public String toString(){
        return super.toString()+" facultyId:"+this.facultyId+','+" tital:"+this.tital+','+" email:"+this.email;
    }
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getFacultyId() {
        return facultyId;
    }

    public void setFacultyId(String facultyId) {
        this.facultyId = facultyId;
    }

    public String getTital() {
        return tital;
    }

    public void setTital(String tital) {
        this.tital = tital;
    }
}
